package homework.gui;

import com.lovo.netCRM.component.LovoTable;
import homework.bean.StudentBean;
import homework.util.DataUtil;

import javax.swing.*;
import java.util.List;

public class ShowTablePanel extends JPanel {

    private LovoTable datas;
    /**
     * 滚动面板
     */
    //private JScrollPane jScrollPane;

    public  ShowTablePanel(){

        this.setLayout(null);

       //创建显示的表格
        datas = new LovoTable(
                this,new String[]{"学生编号","姓名","性别","所在班级"},
                 new String[]{"studentId","name","gender","classBean.name"} //表头对应的对象的属性名
                ,"studentId");//主键名
        //设置表格的位置和大小
        datas.setSizeAndLocation(0,0,800,500);
        //把查询的所有的学生数据存放到表格中
        List<StudentBean> list = DataUtil.getAllStudents();
        datas.updateLovoTable(list);

    }

    public LovoTable getDatas() {
        return datas;
    }
}
